package com.gugee.ins.common.dal.service.brand.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.gugee.ins.common.dal.mapper.brand.InsBrandExtMapper;
import com.gugee.ins.common.dal.service.brand.InsBrandDao;
import com.gugee.ins.common.dto.InsBrandDto;
import com.gugee.ins.common.model.mysql.blogger.InsBloggerMain;
import com.gugee.ins.common.model.mysql.brand.InsBrand;
import com.gugee.ins.common.model.mysql.brand.InsRelBrandBlogger;
import com.gugee.ins.common.model.mysql.brand.InsRelBrandMedia;
import com.gugee.ins.data.common.msg.InsBrandMessage;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * InsBrandDaoImpl
 * @author Huangxin
 */
@Slf4j
@Service
public class InsBrandDaoImpl extends ServiceImpl<InsBrandExtMapper, InsBrand> implements InsBrandDao {

    /**
     * 根据bid更新分类
     * @param bid
     */
    @Override
    public void updateCategory(int bid) {
        baseMapper.updateCategory(bid,System.currentTimeMillis() / 1000);
    }

    /**
     * 获取最大id
     * @return
     */
    @Override
    public int getMaxId() {
        return baseMapper.getMaxId();
    }

    /**
     * 获取定时分页信息
     * @param startId
     * @param endId
     * @param limitTime
     * @return
     */
    @Override
    public List<InsBrandMessage> findInsAnalysisBrandCategoryMessageByPages(int startId, int endId, long limitTime) {
        return baseMapper.findInsAnalysisBrandCategoryMessageByPages(startId,endId,limitTime);
    }

    /**
     * 获取打点定时分页信息
     * @param startId
     * @param endId
     * @return
     */
    @Override
    public List<InsRelBrandBlogger> findInsMarkBrandMessageByPages(int startId, int endId) {
        return baseMapper.findInsMarkBrandMessageByPages(startId,endId);
    }

    /**
     * 获取打点定时分页信息
     * @param startId
     * @param endId
     * @return
     */
    @Override
    public List<InsBrandDto> findInsBrandDtoByPages(int startId, int endId) {
        return baseMapper.findInsBrandDtoByPages(startId,endId);
    }

    @Override
    public List<InsBloggerMain> getBrandBloggerByBid(int bid) {
        return baseMapper.findBrandBloggerByBid(bid);
    }

    @Override
    public List<InsRelBrandMedia> getMediaForCaptionTagger(List<String> usernames, int bid, long beginTime, long endTime) {
        return baseMapper.findMediaForCaptionTagger(usernames,bid,beginTime,endTime);
    }

    @Override
    public List<InsRelBrandMedia> getMediaForTaggerUser(List<Long> uIds, int bid, long beginTime, long endTime) {
        return baseMapper.findMediaForTaggerUser(uIds,bid,beginTime,endTime);
    }

    @Override
    public List<InsRelBrandMedia> getMediaForSponsorUser(List<Long> uIds, int bid, long beginTime, long endTime) {
        return baseMapper.findMediaForSponsorUser(uIds,bid,beginTime,endTime);
    }

    @Override
    public List<InsRelBrandMedia> getMediaForProduct(List<Long> uIds, int bid, long beginTime, long endTime) {
        return baseMapper.findMediaForProduct(uIds,bid,beginTime,endTime);
    }

    @Override
    public List<InsRelBrandMedia> getMediaForBlogger(List<Long> uIds, int bid, long beginTime, long endTime) {
        return baseMapper.findMediaForBlogger(uIds,bid,beginTime,endTime);
    }
}
